#!/usr/bin/python
# -*- coding: utf-8 -*-

import os
import webapp2

from gae.fetch_yp import YPHandler 
from gae.yp_history import YPHistoryHandler 
from gae.prepare_cookie import prepareCookieHandler

from common.cookie import CookieQueue

class MainPage(webapp2.RequestHandler):
    def get(self):
        self.response.headers['Content-Type'] = 'text/plain'
        self.response.out.write('Yupiao.info GAE Proxy')
"""
#test PNG format of GAE. result: RGBA
class ConvHandler(webapp2.RequestHandler):
    def get(self):
        self.response.headers['Content-Type'] = 'image/PNG'
        f = open("pngcanvas/passCodeAction.jpg","rb")
        g = f.read()
        from google.appengine.api.images import *
        p = rotate(g,0) 
        
        self.response.out.write(p)
"""


app = webapp2.WSGIApplication([('/api/yp/.*', YPHandler),
                               ('/api/yp/.*', YPHandler),
                               ('/api/yphistory', YPHistoryHandler),
                               ('/prepareCookie', prepareCookieHandler),
                               ('/', MainPage)],
                              debug=True)
